package com.ey12.service;

import java.util.List;

import com.ey12.db.dao.GmBusinessDAO;
import com.ey12.db.domain.GmBusiness;
import com.ey12.utils.DateUtil;

public class GmBusinessService {
	private GmBusinessDAO gmBusinessDAO;

	public GmBusinessDAO getGmBusinessDAO() {
		return gmBusinessDAO;
	}

	public void setGmBusinessDAO(GmBusinessDAO gmBusinessDAO) {
		this.gmBusinessDAO = gmBusinessDAO;
	}
	
	public List getBusinessList(){
		List list = gmBusinessDAO.findAll();
		if(list.size()>0){
			return list;
		}
		return null;
	}
	public void delBusiness(GmBusiness gm){
		gmBusinessDAO.delete(gm);
	}
	public void updateBusiness(GmBusiness gm){
		gmBusinessDAO.saveOrUpdate(gm);
	}
	public List getBCData(){
		List list = gmBusinessDAO.findAll();
		if(list.size()>0){
			return list;
		}
		return null;
	}
	public void addNew(GmBusiness gm){
		gm.setId(null);
		gm.setCreateDate(new DateUtil().toTimeString());
//		System.out.println(gm.getContent());
		gmBusinessDAO.saveOrUpdate(gm);
	}
}
